Merge with upstream and update Cargo.lock
authorСухарик <suhr@i2pmail.org>
Thu, 4 Sep 2014 09:37:09 +0000 (13:37 +0400)
committerСухарик <suhr@i2pmail.org>
Thu, 4 Sep 2014 09:37:09 +0000 (13:37 +0400)
Conflicts:
src/bin/new.rs
src/cargo/ops/cargo_new.rs

1  2 
Cargo.lock
src/bin/new.rs
src/cargo/ops/cargo_new.rs
tests/test_cargo_new.rs

diff --cc Cargo.lock
index 2f70d286694fbc4a4d0ac235a638d86e55f50c92,2f70d286694fbc4a4d0ac235a638d86e55f50c92..e4882091c9d311293dac32468cea89dac7e44acc
@@@ -35,7 -35,7 +35,7 @@@ dependencies = 
  [[package]]
  name = "encoding"
  version = "0.1.0"
--source = "git+https://github.com/lifthrasiir/rust-encoding#15de58b9cb1fb5998aa6217e794d557eaf80a31f"
++source = "git+https://github.com/lifthrasiir/rust-encoding#35f0d70f65f73ba16f296f9ec675eddee661ba79"
  
  [[package]]
  name = "flate2"
@@@ -99,6 -99,6 +99,6 @@@ name = "url
  version = "0.1.0"
  source = "git+https://github.com/servo/rust-url#bb68de835ad945a72fba44979944a587ba83941a"
  dependencies = [
-- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#15de58b9cb1fb5998aa6217e794d557eaf80a31f)",
++ "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#35f0d70f65f73ba16f296f9ec675eddee661ba79)",
  ]
  
diff --cc src/bin/new.rs
index bac9739a7b673e9fc180743699308a2011678979,c2e56945aa1b2fa086a384d74d3c6ef9aae03a0d..7511746c04c3a8e5176941be90c901ed671a0956
@@@ -14,8 -14,9 +14,10 @@@ Usage
  
  Options:
      -h, --help          Print this message
-     --git               Initialize a new git repository with a .gitignore
+     --no-git            Don't initialize a new git repository
+     --git               Initialize a new git repository, overriding a
+                         global `git = false` configuration
 +    --travis            Create a .travis.yml file
      --bin               Use a binary instead of a library template
      -v, --verbose       Use verbose output
  ")
@@@ -24,11 -25,11 +26,12 @@@ pub fn execute(options: Options, shell
      debug!("executing; cmd=cargo-new; args={}", os::args());
      shell.set_verbose(options.flag_verbose);
  
-     let Options { flag_git, flag_travis, flag_bin, arg_path, .. } = options;
 -    let Options { flag_no_git, flag_bin, arg_path, flag_git, .. } = options;
++    let Options { flag_no_git, flag_travis, flag_bin, arg_path, flag_git, .. } = options;
  
      let opts = ops::NewOptions {
+         no_git: flag_no_git,
          git: flag_git,
 +        travis: flag_travis,
          path: arg_path.as_slice(),
          bin: flag_bin,
      };
index 42b631c92ac699c9e5c4833584086da8092fab52,85a60c5ae8dd4822fd4d846900d76031312e4a45..d74e381e1d89bd0291248488393e4759fe1c5888
@@@ -7,8 -7,8 +7,9 @@@ use util::{CargoResult, human, ChainErr
  use core::shell::MultiShell;
  
  pub struct NewOptions<'a> {
+     pub no_git: bool,
      pub git: bool,
 +    pub travis: bool,
      pub bin: bool,
      pub path: &'a str,
  }
@@@ -35,15 -43,19 +44,23 @@@ fn mk(path: &Path, name: &str, opts: &N
              gitignore.push_str("/Cargo.lock\n");
          }
          try!(File::create(&path.join(".gitignore")).write(gitignore.as_bytes()));
-     } else {
-         try!(fs::mkdir(path, io::UserRWX));
      }
  
-     let author = try!(discover_author());
+     let (author_name, email) = try!(discover_author());
+     // Hoo boy, sure glad we've got exhaustivenes checking behind us.
+     let author = match (cfg.name, cfg.email, author_name, email) {
+         (Some(name), Some(email), _, _) |
+         (Some(name), None, _, Some(email)) |
+         (None, Some(email), name, _) |
+         (None, None, name, Some(email)) => format!("{} <{}>", name, email),
+         (Some(name), None, _, None) |
+         (None, None, name, None) => name,
+     };
 +    if opts.travis {
 +        try!(File::create(&path.join(".travis.yml")).write_str("language: rust\n"));
 +    }
 +
      try!(File::create(&path.join("Cargo.toml")).write_str(format!(
  r#"[package]
  
Simple merge